package com.online.mapper;

import com.online.entity.Replay;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface ReplayMapper {
    /**
     * 新增回复
     * @param replay
     * @return
     */
    @Options(useGeneratedKeys = true,keyProperty = "replayId")
    int add(Replay replay);

    /**
     * 根据ID查找回复
     * @param messageId
     * @return
     */

    List<Replay> findAllById(Integer messageId);

    @Delete("delete from replay where replayId = #{replayId}")
    int delete(Integer replayId);

    @Update("update replay set title = #{title}, replay = #{replay}, replayTime = #{replayTime} where replayId = #{replayId}")
    int update(Replay replay);

    @Select("select messageId,replayId,replay,replayTime from replay where messageId = #{messageId}")
    Replay findById(Integer messageId);

    @Select("select messageId,replayId,replay,replayTime from replay")
    List<Replay> findAll();
}
